import request from "./request";

// 设置用户权限
export const setGroup = (id,data) =>
  request({
    method: "put",
    url: `/users/group/${id}`,
    data,
  });


//获取所有数据  分页
export const getUser = (data) =>
  request({
    method: "get",
    url: "/users",
    params: data,
  });

export const login = (data) =>
  request({
    method: "post",
    url: "/users/login",
    data,
  });

//增加
export const addUser = (data) =>
  request({
    method: "post",
    url: "/users",
    data,
  });

export const delUser = (id) =>
  request({ 
    method: "delete",
    url: `/users/${id}`,
  });

export const editUser = (id, data) =>
  request({
    method: "put",
    url: `/users/${id}`,
    data,
  });

//回调 获取数据
export const fillUser = (id) =>
  request({
    method: "get",
    url: `/users/${id}`,
  });

// 判断字段值是否存在
export const exist = (data) =>
  request({
    method: "get",
    url: `/users/exist`,
    params: data,
  });

//根据多个ID批量删除用户
export const delUsers = (id) =>
  request({
    method: "delete",
    url: `/users`,
  });

//获取登陆用户信息
export const loginedAdd = (data) =>
  request({
    method: "get",
    url: "/users/logined",
    params: data,
  });


